
/**
\file
Defines the rainbow::decorated_draw_information struct.
\author Sean Tromans
*/

#ifndef	RAINBOW_VIEWPORT_PASS_DECORATED_DRAW_INFORMATION_HPP
#define	RAINBOW_VIEWPORT_PASS_DECORATED_DRAW_INFORMATION_HPP

#include <rainbow/draw_information/draw_information.hpp>
#include <sun/lua/lua_fwd.hpp>

namespace rainbow
{
	/**
	The draw_information provided to the pass object, along with the approximate depth of the mesh.
	\author Sean Tromans
	*/
	struct	decorated_draw_information
	{
		//
		//	Public Member Functions
		//
		public:

			/**
			Default Constructor.
			\author Sean Tromans
			*/
			decorated_draw_information( );

			/**
			Constructor.
			@param depth The approximate depth of the mesh to be drawn.
			@param info The information explaining how to draw the provided mesh.
			\author Sean Tromans
			*/
			decorated_draw_information( float depth, draw_information const & info );

		//
		//	Public Member Variables
		//	
		public:

			float				depth;	///< The approximate depth of the mesh to be drawn.
			draw_information	info;	///< The information explaining how to draw the provided mesh.

		//
		//	Static Member Functions
		//
		public:

			/**
			Exposes the draw_command to lua.
			@param L The Lua State being initialised.
			\author Sean Tromans.
			*/
			static void lua_interface( lua_State * L );

			/**
			The default ordering of decorated_draw_informations.
			Orders opaque objects ahead of transparent objects.
			If opaque sorts by material then from front to back.
			If transparent sorts from back to front, then by material.
			@param a The first decorated_draw_information to compare.
			@param b The first decorated_draw_information to compare.
			@returns true if a compares less than b. False otherwise.
			\author Sean Tromans
			*/
			static bool default_ordering( decorated_draw_information const & a, decorated_draw_information const & b );

			/**
			Similar to the default ordering mechanism, but ignored the opacity setting of the information.
			First sorts by material and then sorts from front-to-back.
			@param a The first decorated_draw_information to compare.
			@param b The first decorated_draw_information to compare.
			@returns true if a compares less than b. False otherwise.
			\author Sean Tromans
			*/
			static bool order_without_transparency( decorated_draw_information const & a, decorated_draw_information const & b );
	};

};

#endif	//RAINBOW_VIEWPORT_PASS_DECORATED_DRAW_INFORMATION_HPP
